﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EventHomeUserControl.ascx.cs"
    Inherits="JM.JCY.SharePointComponent.Event.EventHome.EventHomeUserControl" %>
<script type="text/javascript">

    $(document).ready(function () {
        $("#imgToggleEvent").click(function () {
            var div = document.getElementById("divToggleEvent");
            if (div.style.display == "") {
                div.style.display = "none";
                $("#imgToggleEvent").attr("src", "/_layouts/JM.JCY.Resource/images/toggle_expand.png");
                window.clearTimeout(timeID);
            }
            else {
                div.style.display = "";
                $("#imgToggleEvent").attr("src", "/_layouts/JM.JCY.Resource/images/toggle_collapse.png");
                timeID = setInterval(changeBroadcast, timeInterval);
            }
        });
    });

    function RedirectToViewCurrentEvent(sender, EventId) {
        var URIScheme = "http://";
        var host = document.location.host;
        var url = URIScheme + host + "/EventPages/ViewEvent.aspx?EventId=" + EventId;
        sender.href = url;
    }

    function RedirectToSearchEvent(sender) {

        var URIScheme = "http://";
        var host = document.location.host;
        var url = URIScheme + host + "/EventPages/SearchEventReceiver.aspx";
        sender.href = url;
    }

</script>
<div>
    <table class="main" width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td>
                <table class="webpart" width="500" cellpadding="0" cellspacing="0">
                    <tr>
                        <th class="title" width="50%">
                            <img src="/_layouts/JM.JCY.Resource/images/broadcast.png" />
                            工作计划
                        </th>
                        <th class="link" align="right" width="50%">
                            <asp:LinkButton ID="lbViewAll" runat="server" OnClientClick="RedirectToSearchEvent(this)">更多</asp:LinkButton>
                            <img class="toggle" id="imgToggleEvent" src="/_layouts/JM.JCY.Resource/images/toggle_collapse.png" />
                        </th>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div id="divToggleEvent">
                                <table width="100%" class="webpartContent">
                                    <tr>
                                        <td>
                                            <div>
                                                <asp:DataList ID="dlEvent" runat="server" RepeatColumns="1" OnItemDataBound="dlEvent_ItemDataBound"
                                                    Width="100%">
                                                    <ItemTemplate>
                                                        <table>
                                                            <tr>
                                                                <td valign="top" width="30%">
                                                                    <asp:Label ID="lblEffDate" runat="server" Text='<%# Eval("CREATED_TIME") %>'></asp:Label>
                                                                </td>
                                                                <td valign="top" width="20%">
                                                                </td>
                                                                <td valign="top">
                                                                    <asp:LinkButton ID="lbSubject" runat="server" class="linkTitle" Text='<%#Eval("Subject")%>'
                                                                        OnClientClick='<%# String.Format("RedirectToViewCurrentEvent({0},{1})","this",Eval("ID")) %>'></asp:LinkButton>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ItemTemplate>
                                                </asp:DataList></div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
